package com.ruoyi.background.service.impl;

import com.ruoyi.background.domain.AppRankTeam;
import com.ruoyi.background.domain.AppRankUser;
import com.ruoyi.background.mapper.AppRankTeamMapper;
import com.ruoyi.background.service.IAppRankTeamService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 队伍排行榜Service业务层处理
 *
 * @author susu
 * @date 2024-09-04
 */
@Service
public class AppRankTeamServiceImpl implements IAppRankTeamService {
    @Autowired
    private AppRankTeamMapper appRankTeamMapper;

    /**
     * 查询队伍排行榜
     *
     * @param id 队伍排行榜主键
     * @return 队伍排行榜
     */
    @Override
    public AppRankTeam selectAppRankTeamById(Long id) {
        return appRankTeamMapper.selectAppRankTeamById(id);
    }

    /**
     * @param teamId 队伍id
     * @return 结果
     */
    @Override
    public AppRankTeam selectAppRankByTeamId(Long teamId) {
        return appRankTeamMapper.selectAppRankByTeamId(teamId);
    }

    /**
     * 查询队伍排行榜列表
     *
     * @param appRankTeam 队伍排行榜
     * @return 队伍排行榜
     */
    @Override
    public List<AppRankTeam> selectAppRankTeamList(AppRankTeam appRankTeam) {
        return appRankTeamMapper.selectAppRankTeamList(appRankTeam);
    }

    @Override
    public List<AppRankUser> getTeamRankList(AppRankUser appRankUser) {
        return appRankTeamMapper.getTeamRankList(appRankUser);
    }

    /**
     * 新增队伍排行榜
     *
     * @param appRankTeam 队伍排行榜
     * @return 结果
     */
    @Override
    public int insertAppRankTeam(AppRankTeam appRankTeam) {
        appRankTeam.setCreateTime(DateUtils.getNowDate());
        return appRankTeamMapper.insertAppRankTeam(appRankTeam);
    }

    /**
     * 修改队伍排行榜
     *
     * @param appRankTeam 队伍排行榜
     * @return 结果
     */
    @Override
    public int updateAppRankTeam(AppRankTeam appRankTeam) {
        return appRankTeamMapper.updateAppRankTeam(appRankTeam);
    }

    /**
     * 批量删除队伍排行榜
     *
     * @param ids 需要删除的队伍排行榜主键
     * @return 结果
     */
    @Override
    public int deleteAppRankTeamByIds(Long[] ids) {
        return appRankTeamMapper.deleteAppRankTeamByIds(ids);
    }

    /**
     * 删除队伍排行榜信息
     *
     * @param id 队伍排行榜主键
     * @return 结果
     */
    @Override
    public int deleteAppRankTeamById(Long id) {
        return appRankTeamMapper.deleteAppRankTeamById(id);
    }
}
